﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AForge.Video.DirectShow;
using EOSDigital.SDK;

namespace NewCapturerDemo
{
    public class DslrProperties
    {

        public DslrProperties()
        {
            InitPoperties();
        }

        private Dictionary<PropertyID, PropPair> Properties = new Dictionary<PropertyID, PropPair>();

        public void LoadPopertiesFromIni()
        {
            foreach (KeyValuePair<PropertyID, PropPair> p in Properties)
            {
                p.Value.LoadSetting();
            }
        }

        public void InitPoperties()
        {
            Properties.Clear();
            Properties.Add(PropertyID.Tv,			new PropPair("Tv"));
            Properties.Add(PropertyID.Av,			new PropPair("Av"));
            Properties.Add(PropertyID.ISO,			new PropPair("ISO"));
            Properties.Add(PropertyID.WhiteBalance, new PropPair("WhiteBalance"));
            Properties.Add(PropertyID.ImageQuality, new PropPair("ImageQuality"));
            Properties.Add(PropertyID.MeteringMode, new PropPair("MeteringMode"));
            Properties.Add(PropertyID.PictureStyle, new PropPair("PictureStyle"));
            Properties.Add(PropertyID.Evf_AFMode,   new PropPair("EvfAFMode"));
            
            //LoadPopertiesFromIni();
        }

		public void SaveCurrCamPropValue()
		{
			foreach (KeyValuePair<PropertyID, PropPair> p in Properties)
			{
				p.Value.SaveCurrentValue();
			}
		}

		public PropPair this[PropertyID cp]
		{
			get
			{
				if (Properties.ContainsKey(cp))
					return Properties[cp];
				else
					return null;
			}
			set
			{
				Properties[cp] = value;
			}
		}

		public string StringValues()
		{
			return string.Format("快门: {0}, 光圈: {1}, ISO: {2}, 白平衡: {3}, 图片质量: {4}, 测光模式: {5}, 照片风格: {6}, 对焦模式: {7}",
			   Properties[PropertyID.Tv].Value,
			   Properties[PropertyID.Av].Value,
			   Properties[PropertyID.ISO].Value,
			   Properties[PropertyID.WhiteBalance].Value,
			   Properties[PropertyID.ImageQuality].Value,
			   Properties[PropertyID.MeteringMode].Value,
			   Properties[PropertyID.PictureStyle].Value,
		       Properties[PropertyID.Evf_AFMode].Value);
		}
	}
}
